package com.byjh.app.service.impl;

import java.util.List;
import java.util.stream.Collectors;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.byjh.app.mapper.ExamLogsMapper;
import com.byjh.app.domain.ExamLogs;
import com.byjh.app.service.IExamLogsService;

/**
 * 试卷答题记录Service业务层处理
 * 
 * @author Dhq
 * @date 2025-04-01
 */
@Service
public class ExamLogsServiceImpl implements IExamLogsService 
{
    @Autowired
    private ExamLogsMapper examLogsMapper;

    /**
     * 查询试卷答题记录
     * 
     * @param id 试卷答题记录主键
     * @return 试卷答题记录
     */
    @Override
    public ExamLogs selectExamLogsById(Long id)
    {
        return examLogsMapper.selectExamLogsById(id);
    }

    /**
     * 查询试卷答题记录列表
     * 
     * @param examLogs 试卷答题记录
     * @return 试卷答题记录
     */
    @Override
    public List<ExamLogs> selectExamLogsList(ExamLogs examLogs)
    {
        return examLogsMapper.selectExamLogsList(examLogs);
    }


    /**
     * 批量插入试卷答题记录
     *
     * @param examLogsList 试卷答题记录集合
     */
    @Override
    public void batchInsertExamLogs(List<ExamLogs> examLogsList,Long id){
        // 直接遍历列表并设置examId，避免创建不必要的新列表
        for (ExamLogs examLogs : examLogsList) {
            examLogs.setExamId(id);
        }
        examLogsMapper.batchInsertExamLogs(examLogsList);
    }
}
